from llama_index.core import SimpleDirectoryReader


def set_metadata(filename):
    return {"file_name2": filename}


data_dir = 'D:/pythonRoom/llm_llama/data'
documents = SimpleDirectoryReader(
    input_dir=data_dir,
    file_metadata=set_metadata
).load_data()

for doc in documents:
    print(doc.metadata)
